<template>
    <div class="lb-example" @click="cs">
      {{mal}}
      <div mm='cla?6:""'></div>
    </div>
</template>

<script>
  import Vue from 'vue'
    export default {
      name: "m_example",
      data () {
        return {
          a: {
            b: {
              c: {
                m: 2
              }
            }
          },
          l: [1,2],
          k: {
            m: [{
              l: 2
            }]
          },
          cal: 6
        }
      },
      /*watch: {
        cs: [
          {
            handler () {
              console.log(22)
            },
            immediate: true
          },
          () => console.log(33)
        ]
      },*/
      methods: {
        exl (val) {
          return val !== val
        },
        cs () {
          //this.$set(this.a.b.c.__ob__, 'kk', [1])
          //this.$set(this.l, [0], 5)
          //this.$set(this.k, 'n', {a: 2})
          this.cal = 9;
        }
      },
      computed: {
        mal: {
          get () {
            return this.cal
          },
          set (val) {
            this.cal = val;
          }
        }
      },
      mounted () {
        //console.log(this.a.b.c)
        /*let a = [1]
        const arrayProto = Array.prototype;
        const arrayMethods = Object.create(arrayProto);
        protoAugment(a, arrayMethods)
        function protoAugment (target, src) {
          target.__proto__ = src
        }
        console.log(a)*/
        let obj = {
          a: {
            b: [1]
          },
        }
        function kk(a,b) {
          let m = a[b];
          Object.defineProperty(a, b, {
            enumerable: true,
            configurable: true,
            get: function reactiveGetter () {
              console.log(`${b}`)
              return m
            },
            set: function reactiveSetter (newVal) {
              m = newVal;
              console.log('我先执行了')
            }
          })
        }
        kk(obj,'a')
        kk(obj.a,'b')
        obj.a.b[0] = 9
        console.log(obj)
        /*let IS_REGEX_CAPTURING_BROKEN = false;
        'x.'.replace(/x(.)?/g, function (m, g) {
          console.log(m,g)
          return g
        })*/
        /*console.log(this)
        this.$nextTick().then(() => {
          console.log(3)
        })
        this.$nextTick(() => {
          console.log(4)
        })
        this.$watch(function () {
          return this.k
        }, {
          handler() {
            console.log(333)
          },
          immediate: true
        })*/
        /*class Model {
          constructor() {
            this.foo = '123'
            this._bar = 11
          }
          get bar() {
            return this._bar;
          }
          set bar(newvalue) {
            this._bar = newvalue;
          }
        }
        let m = new Model();
        console.log(m)*/
        /*function Model() {
          this.foo = '123'
          this._bar = null
        }
        Model.prototype = {
          get bar() {
            return this._bar;
          },
          set bar(newvalue) {
            this._bar = newvalue;
          }
        }
        let  i = new Model()
        console.log(i)*/
      }
    }
</script>

<style scoped>
  .lb-example {
    height: 100%;
  }
</style>
